package uk.co.hs.dao.web.admin;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import uk.co.hs.dao.generic.UtilisoftGenericDao;
import uk.co.hs.domain.web.WebRole;

@Repository("hs_webRoleDao")
public class WebRoleDao extends UtilisoftGenericDao<WebRole, Long>
{
  /**
   * Get WebRole given name.
   *
   * @param aName String
   * @return WebRole
   */
  public WebRole getWebRole(final String aName)
  {
    Query query = getSession().createQuery("FROM WebRole role WHERE role.name = :roleName");
    query.setParameter("roleName", aName);
    return (WebRole) query.uniqueResult();
  }
}
